﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Hangu.WebClient.Controllers
{
    public class TravelController : BaseController
    {
        //
        // GET: /Travel/

        public ActionResult Index()
        {
            IninFlashXml(4);
            ViewData["Traveling"] = serviceTravel.GetForIndex();//正在进行
            SearchParma.Pagination.PageSize = 3;
            SearchParma.ClassType = 1;
            ViewData["TravelPlans"] = serviceTravel.GetAll(SearchParma);
            SearchParma.Pagination.PageSize = HelperCommon.TravelIsTop;
            SearchParma.ClassType = 0;
            ViewData["TravelIsTop"] = serviceTravel.GetForTop(SearchParma);//精彩回顾
         
            return View();
        }

        public ActionResult List()
        {
            IninFlashXml(4);
            ViewData["pageform"] = "TravelListpagerForm";
            SearchParma.Pagination.PageSize = HelperCommon.TravelPageSize;
            var models = serviceTravel.GetAll(SearchParma);

            return View(models);
        }
        public ActionResult Plans()
        {
            IninFlashXml(4);
            ViewData["pageform"] = "TravelListpagerForm";
            SearchParma.Pagination.PageSize = HelperCommon.TravelPageSize;
            SearchParma.ClassType = 1;
            var models = serviceTravel.GetAll(SearchParma);

            return View(models);
        }
        //
        // GET: /Travel/Details/5

        public ActionResult Detail(int id)
        {
            var model = serviceTravel.GetByID(id);
            return View(model);
        }
        public ActionResult play(int id)
        {
            if (Session["Member"] == null)
            {
                return RedirectToAction("Login", "Vip");
            }
            ViewData["pageform"] = "TravelPlayForm";
            var model = serviceTravel.GetByID(id);
            return View(model);
        }
        //
        // GET: /Travel/Create

        public ActionResult Create()
        {
            return View();
        } 

        //
        // POST: /Travel/Create

        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        
        //
        // GET: /Travel/Edit/5
 
        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /Travel/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Travel/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /Travel/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
